<script language="javascript">
function showNewWindow(id)
{
    window.open("/product/product_info/"+id,"_blank","height=500,width=700,top=300,left=400,toolbar=no,menubar=no,scrollbars=yes,resizable=no,location=no,status=no");
}
</script>
<h1>产品管理 - <span id="secondHeading">产品库存</span></h1>
<%=form_tag ({:action=>'list_storeProduct'}, :id=>"input-form" )%>
<div id="searchBar">
	<img src="/images/search.gif">
	<%=hidden_field_tag(:type,@type)%>
	品名规格<input type="text" name="product_serial" maxlength="20">
	导针规格<input type="text" name="product_name" size="20" maxlength="20">&nbsp;<input type="submit" class="sub" value="查询">
</div>
</form>

<TABLE border="0" id="INPUT_TABLE">
	<TR>
		<%@stores.each do |store|%>
		<TD align="center"><a href="/product/list_storeProduct?storeid=<%=store.id%>&type=<%=@type%>" title="<%=store.name%>"><img src="/images/store_small.jpg"/><br><%=store.name%></a></TD>
		<%end%>
	</TR>
</TABLE>

<% if @flash[:notice] -%>
        <div id="notice"><%= @flash[:notice] %></div>
<% end -%>
<TABLE border="0" id="LIST_TB">
	<% if @department and error_messages_for(:storeProduct) %>
	<%=error_messages_for(:storeProduct)%>
	<% end %>
	<%if @storeProducts%>
	<TR id="LIST_TB_TITLE">
	        <TD>品名规格</TD>
		<TD>导针规格</TD>
		<TD>所在仓库</TD>
		<TD>数量（kpcs）</TD>
		<TD><%if ('move'.eql? @type)%>调配<%elsif 'change'.eql? @type%>修改<%end%></TD>
	</TR>
	<%@storeProducts.each do |sp|%>
	<%if sp.product.state==1%>
	<TR id="LIST_TB_CONTENT1">
                <TD><a href="javascript:showNewWindow(<%=sp.product.id%>)"><%=sp.product.serial%></a></TD>
		<TD><a href="javascript:showNewWindow(<%=sp.product.id%>)"><%=sp.product.name%></a></TD>
		<TD><%=sp.store.name%></TD>
		<TD><%=sp.current_count%></TD>
		<TD><%if ('move'.eql? @type)%><a href="/product/move_to?spid=<%=sp.id%>">调配</a><%elsif 'change'.eql? @type%><a href="/product/change?spid=<%=sp.id%>">修改</a><%end%></TD>
	</TR>
	<%end%>
	<%end%>
	<%else%>
	<img src="/images/alert.gif">&nbsp;<font color="red">请您选择仓库</font>
	<%end%>
</TABLE>
<%if @storeProducts%>
<%end%>
<table>
        <tr>
                <td>
                        <input type="button" value="打印当前页" class="sub" onclick="openPrintWindow('LIST_TB')"/>
                        <input type="button" value="导出当前数据" class="sub" onclick="CellAreaExcel('LIST_TB')"/>
                </td>
        </tr>
</table>
